package uia.alumni.search;

import uia.alumni.profile.*;
import java.io.PrintWriter;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceUnit;
import javax.servlet.http.HttpServletRequest;
import uia.alumni.web.Page;



/**
 * Make a form for registering a new user.
 * @author Even Åby Larsen (even.larsen@uia.no)
 */
public class Search extends Page implements Constants {

    /** SERVLET_NAME is used for consistency checking of web.xml */
    public static final String SERVLET_NAME = "search.search";

    @PersistenceUnit(name=PERSISTENCE_UNIT)
    private EntityManagerFactory emf;


    public Search() {
        super(null);
    }


    /**
     * Write a form for registering new users.
     * @param out
     * @param request
     */
    public void writeBody(PrintWriter out, HttpServletRequest request) {
        EntityManager em = emf.createEntityManager();

        out.println("<h1>Register</h1>");
            out.println("<p>Please enter your email address, and a password of your choice.</p>");
            printStartForm(out, CreateProfile.SERVLET_NAME);
            out.println("<table>");
            // metode som referer til Page -> PrintTextField()
            printTextField(out, "Persons", PERSONS, "", true);
            out.println("</table>");
            out.println("<input type=\"submit\" value=\"\"/>");
            out.println("</form>");
    }

    public final static long serialVersionUID = 1;

}
